
Partial Class Modules_Questionnaires_Controls_cfgNumber
    Inherits System.Web.UI.UserControl
    Implements DotNetPM.Business.Questionnaire.UserControls.IConfigUC

    Private _AnswerType As Integer

    Public Property AnswerType() As Integer Implements DotNetPM.Business.Questionnaire.UserControls.IConfigUC.AnswerType
        Get
            Return _AnswerType
        End Get
        Set(ByVal value As Integer)
            _AnswerType = value
        End Set
    End Property

    Public Property Config() As String Implements DotNetPM.Business.Questionnaire.UserControls.IConfigUC.Config
        Get
            Dim build As New StringBuilder
            build.Append(_AnswerType)
            build.Append("||" & rRequired.SelectedIndex)
            build.Append("||" & txtMin.Text)
            build.Append("||" & txtMax.Text)
            Return build.ToString
        End Get
        Set(ByVal value As String)
            Dim val As String() = Split(value, "||")
            _AnswerType = val(0)
            Integer.TryParse(val(1), rRequired.SelectedIndex)
            txtMin.Text = val(2)
            txtMax.Text = val(3)
        End Set
    End Property

    Public Sub Reset1() Implements DotNetPM.Business.Questionnaire.UserControls.IConfigUC.Reset
        ' Clear values
        txtMin.Text = ""
        txtMax.Text = ""
        rRequired.SelectedIndex = 0
        'Response.Write("Resetting<br/>")
    End Sub



    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ModifiedValidators(_AnswerType)
        Reset()
        'Response.Write("Type = " & compMin.Type.ToString & " || " & compMax.Type.ToString & "<br/>")
        'Response.Write("ValueToCompare = " & compMin.ValueToCompare & " || " & compMax.ValueToCompare & "<br/>")
        'Response.Write("Operator = " & compMin.Operator.ToString & " || " & compMax.Operator.ToString & "<br/>")
    End Sub

    Private Sub ModifiedValidators(ByVal type As Integer)

        Select Case type
            'Case 0
            '    compMin.Type = ValidationDataType.Currency
            'Case 1
            '    compMin.Type = ValidationDataType.Date
            Case 2
                compMin.Type = ValidationDataType.Double
                compMax.Type = ValidationDataType.Double
                compMin.ValueToCompare = "-9999999999999999"
            Case 3
                compMin.ValueToCompare = Integer.MinValue
                compMin.Type = ValidationDataType.Integer
                compMax.Type = ValidationDataType.Integer
        End Select
    End Sub

End Class
